home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / TransSkel / Demos / Pascal Demos / Button / Button.p next >
Text File  |  1994-02-23  |  1KB  |  74 lines

  1. { TransSkel button application in Pascal }
  2.  
  3. { 10 Feb 94 Version 1.00, Paul DuBois }
  4.  
  5. program Button;
  6.  
  7.     uses
  8.         TransSkel, ButtonGlobals, Dialog1, Dialog2, Dialog3, Document;
  9.  
  10.  
  11. {--------------------------------------------------------------------}
  12. { Menu handling procedures }
  13. {--------------------------------------------------------------------}
  14.  
  15.  
  16. { Handle selection of "About Button..." item from Apple menu }
  17.  
  18.     procedure DoAppleMenu (item: Integer);
  19.         var
  20.             ignore: Integer;
  21.     begin
  22.         ignore := SkelAlert(aboutAlrtRes, SkelDlogFilter(nil, true), skelPositionOnParentDevice);
  23.         SkelRmveDlogFilter;
  24.     end;
  25.  
  26.  
  27. { Process selection from File menu }
  28.  
  29.     procedure DoFileMenu (item: Integer);
  30.         const
  31.  
  32.             doDialog1Item = 1;
  33.             doDialog2Item = 2;
  34.             doDialog3Item = 3;
  35.     { sepLine }
  36.             quitAppItem = 5;
  37.     begin
  38.         case item of
  39.             doDialog1Item: 
  40.                 DoDialog1;
  41.             doDialog2Item: 
  42.                 DoDialog2;
  43.             doDialog3Item: 
  44.                 DoDialog3;
  45.             quitAppItem: 
  46.                 SkelStopEventLoop;
  47.         end;
  48.     end;
  49.  
  50.  
  51. { Initialize menus.  Tell TransSkel to process the Apple menu }
  52. { automatically, and associate the proper procedures with the }
  53. { File menu. }
  54.  
  55.     procedure SetupMenus;
  56.         var
  57.             m: MenuHandle;
  58.             ignore: Boolean;
  59.     begin
  60.         SkelApple('About Button…', @DoAppleMenu);
  61.         m := GetMenu(fileMenuRes);
  62.         ignore := SkelMenu(m, @DoFileMenu, nil, false, true);
  63.     end;
  64.  
  65.  
  66. begin
  67.     SkelInit(nil);
  68.     horizRatio := FixRatio(1, 2);
  69.     vertRatio := FixRatio(1, 5);
  70.     SetupMenus;
  71.     SetupDocument;
  72.     SkelEventLoop;
  73.     SkelCleanup;
  74. end.